<template>
  <el-drawer
    :title="title"
    destroy-on-close
    :with-header="withHeader"
    :visible.sync="drawer"
    :size="size"
    :direction="direction"
    @close="handleClose"
  >
    <slot></slot>
  </el-drawer>
</template>

<script>
export default {
  props: {
    size: {
      type: String,
      default: "30%"
    },
    title: {
      type: String,
      default: "drawer"
    },
    withHeader: {
      type: Boolean,
      default: true
    },
    direction: {
      type: String,
      default: "rtl"
    }
  },
  data() {
    return {
      drawer: false
    }
  },
  methods: {
    handleClose() {
      this.drawer = false
      this.$emit("handleClose")
    }
  }
}
</script>
